/**
 * elancom Corporation copy right 2012 - 2015  
 *   
 * $Header: https://192.168.1.224/svn/elancom/product/elancom-platform/trunk/src/main/java/com/elancom/framework/filter/OutputErrorExceptionFilter.java 1034 2012-07-02 03:09:12Z lanzhouxue $
 * $Id: OutputErrorExceptionFilter.java 1034 2012-07-02 03:09:12Z lanzhouxue $
 * $Author: lanzhouxue $
 * $Date: 2012-07-02 11:09:12 +0800 (周一, 02 七月 2012) $
 * $Revision: 1034 $
 */
package com.elancom.framework.web.filters;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.filter.OncePerRequestFilter;

/**
 * @author elancom
 * @date 2012-6-18
 */
public class OutputErrorExceptionFilter extends OncePerRequestFilter {

	@Override
	protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
		try {
			filterChain.doFilter(request, response);
		} catch (final Exception e) {
			try {
				// FIXME
				final String jsonString = "";
				response.getWriter().write(jsonString);
			} catch (final IOException ioe) {
				ioe.printStackTrace();
				throw new RuntimeException("write json error", ioe);
			}
		} finally {
		}
	}
}
